{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# ECG Rhythm Classification\n",
    "## 1. Create Training Dataset\n",
    "### Sebastian D. Goodfellow, Ph.D."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Setup Noteboook"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Import 3rd party libraries\n",
    "import os\n",
    "import sys\n",
    "\n",
    "# Import local Libraries\n",
    "sys.path.insert(0, r'C:\\Users\\sebastian goodfellow\\Documents\\code\\deep_ecg')\n",
    "from deepecg.training.data.training_dataset_disc import TrainingDB\n",
    "from deepecg.config.config import DATA_DIR\n",
    "\n",
    "# Configure Notebook\n",
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "%matplotlib inline\n",
    "%load_ext autoreload\n",
    "%autoreload 2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1. Create Training Dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Inputs\n",
    "path_labels=os.path.join(DATA_DIR, 'datasets')\n",
    "path_save=os.path.join(DATA_DIR, 'training')\n",
    "classes=['N', 'A', 'O', '~']\n",
    "datasets={'train': 0.8, 'val': 0.2, 'test': 0.}\n",
    "duration=60.\n",
    "fs = 200\n",
    "\n",
    "# Get training dataset\n",
    "train_db = TrainingDB(path_labels=path_labels, path_save=path_save, duration=duration, \n",
    "                      classes=classes, datasets=datasets, augment=True, fs=fs)\n",
    "\n",
    "# Generate datset\n",
    "train_db.generate()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
